package com.example.demo.service;

import com.example.demo.entity.Type;
import com.example.demo.mapper.DishMapper;
import com.example.demo.mapper.TypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeService {

    @Autowired
    private TypeMapper typeMapper;

    @Autowired
    private DishMapper dishMapper;

    public List<Type> getList() {
        return typeMapper.getList();
    }

    public int add(Type type) {
        return typeMapper.add(type);
    }

    public int delete(Integer typeId) {
        dishMapper.updateTypeId(typeId);
        return typeMapper.delete(typeId);
    }
}
